﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>登陆</title>
    <environment include="Development">
        <link href="~/Layui/src/layuiadmin/layui/css/layui.css" rel="stylesheet" />
        <link href="~/Layui/src/layuiadmin/style/login.css" rel="stylesheet" />
        <link href="~/Layui/src/layuiadmin/style/admin.css" rel="stylesheet" />
        <script src="~/Layui/src/layuiadmin/layui/layui.js"></script>
        <script src="~/JQuery/jQuery-2.1.1.js"></script>
        <script src="~/verify/jq-slideVerify.js"></script>
        <script>
            $(function () {
                var SlideVerifyPlug = window.slideVerifyPlug;
                var slideVerify2 = new SlideVerifyPlug('#verify-wrap2', {
                    wrapWidth: '滑动验证',
                    initText: '请按住滑块',
                    sucessText: '验证通过',
                    getSucessState: function (res) {
                        if (res) {
                            $("#loginSubmit").css("display", "block")
                        }
                    }
                });
                $("#loginSubmit").click(function () {
                    var id = $("#LAY-user-login-username").val();
                    var name = $("#LAY-user-login-password").val();
                    $("#msg").html("");
                    if (id == null || id == undefined || id == "") {
                        $("#msg").html("请输入用户名");
                        shake("msg");
                        return false;
                    }
                    if (name == null || name == undefined || name == "") {
                        $("#msg").html("请输入密码");
                        shake("msg");
                        return false;
                    }
                    $.post("/Login/Login", { "userName": id, "passWord": name }, function (data) {
                        var result = JSON.parse(data);
                        if (!result.Item1) {
                            $("#msg").html(result.Item2);
                            shake("msg");
                        } else {
                            location.href = "/Home/Index";
                        }
                    })
                })
            })
            //抖动函数
            function shake(o) {
                var $panel = $("#" + o);
                box_left = ($(window).width() - $panel.width()) / 16;
                $panel.css({ 'left': box_left, 'position': 'absolute' });
                for (var i = 1; 4 >= i; i++) {
                    $panel.animate({ left: box_left - (40 - 10 * i) }, 50);
                    $panel.animate({ left: box_left + 2 * (40 - 10 * i) }, 50);
                }
            }
        </script>
    </environment>
</head>
<body>


    <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
        <div class="layadmin-user-login-main">
            <div class="layadmin-user-login-box layadmin-user-login-header">
                <h2>MyCode</h2>
                <p>layui 官方出品的单页面后台管理模板系统</p>
            </div>
            <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                    <input type="text" style="width:105%" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                    <input type="password" style="width:105%" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="layui-col-xs7">
                            <div class="verify-wrap" id="verify-wrap2"></div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid" style="width:105%;display:none;" lay-submit lay-filter="LAY-user-login-submit" id="loginSubmit">登 入</button>
                </div>
                <div class="layui-form-item" style="margin-bottom: 20px;">

                    <a lay-href="/user/forget" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
                </div>
                <div class="layui-form-item" style="text-align:center;font-size:16px;color:red;">
                    <span id="msg" style="text-align:center;font-weight:bolder;">
                        
                    </span>
                </div>
            </div>
        </div>

        <div class="layui-trans layadmin-user-login-footer">

            <p>© 2018 <a href="http://www.layui.com/" target="_blank">layui.com</a></p>
        </div>
    </div>
</body>
</html>